package cn.sofwin.boot.crud.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.beans.factory.annotation.Autowired;
import cn.sofwin.core.mvc.bean.Meta;
import cn.sofwin.core.mvc.annotation.BaseDao;
import cn.sofwin.core.mvc.service.impl.BaseServiceImpl;
import cn.sofwin.boot.crud.entity.User;
import cn.sofwin.boot.crud.dao.UserDao;
import cn.sofwin.boot.crud.service.UserService;

/**
 * 服务层
 * @author LetCode
 * @since 1.0
 *
 */
@CacheConfig(cacheNames = "user")
@Service("userService")
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {
	
	@BaseDao
	@Autowired
	UserDao userDao;

	@Cacheable
	@Override
	public Meta loadMetaInfo(){
		Meta meta = new Meta("", "user");

		// 增加表头字段信息
		meta.addColumn("id", "序号")
		      .addColumn("username", "用户名")
		      .addColumn("password", "密码")
		      .addColumn("nickname", "昵称")
		      .addColumn("addTime", "添加时间")
		      .addColumn("status", "状态：-1删除，0冻结，1正常");

		return meta;
	}

	
}